﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CayleyTree
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            cb_color.SelectedIndex = 0;
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Draw.graphics = this.panel1.CreateGraphics();
            Draw.graphics.Clear(BackColor);
            int n; int pen;
            try
            {
                Draw.n = (int)UpDown_N.Value;
                Draw.leng = (int)UpDown_Leng.Value;
                Draw.per1 = (double)UpDown_Per1.Value;
                Draw.per2 = (double)UpDown_Per2.Value;
                Draw.th1 = (double)UpDown_th1.Value * Math.PI / 180;
                Draw.th2 = (double)UpDown_th2.Value * Math.PI / 180;
                pen = cb_color.SelectedIndex;
            }
            catch
            {
                throw new ArgumentException("Wrong argument");
            }
            Draw.drawCayleyTree(Draw.n, 200, 300, Draw.leng, -Math.PI / 2, pen);
        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {

        }

        private void UpDown_th1_ValueChanged(object sender, EventArgs e)
        {

        }

        private void UpDown_Leng_ValueChanged(object sender, EventArgs e)
        {

        }

        private void cb_color_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}
